//Arnold Baghomian
//homework5
//baghomia.onid@oregonstate.edu
//CS362 assignment 3


#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>


void testupdateCoins() {
 struct gameState GS;
 struct gameState* G = &GS;
  int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, 
           sea_hag, tribute, smithy};
  
//  int initializeGame(int numPlayers, int kingdomCards[10], int randomSeed,
//		   struct gameState *state) {

initializeGame(2, k, 3141, G);
//3141 gives 4 copper in hand
//printf(" coin count is a: %d\n",G->coins);


int player = 0;  
//int updateCoins(int player, struct gameState *state, int bonus)  
updateCoins(player, G, 0);
    

 if (G->coins == 4)
        printf("updateCoins(): PASS when test containing 3 copper\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper\n");

updateCoins(player, G, 5);
    
 if (G->coins == 9)
        printf("updateCoins(): PASS when test containing 3 copper 5 bonus\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 5 bonus\n");

G->hand[player][G->handCount[player]] = silver;
G->handCount[player]++;

updateCoins(player, G, 0);
    
 if (G->coins == 6)
        printf("updateCoins(): PASS when test containing 3 copper 1 silver\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 1 silver \n");

updateCoins(player, G, 7);
    
 if (G->coins == 13)
        printf("updateCoins(): PASS when test containing 3 copper 1 silver 7 bonus\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 1 silver 7 bonus\n");

G->hand[player][G->handCount[player]] = silver;
G->handCount[player]++;

updateCoins(player, G, 0);
    
 if (G->coins == 8)
        printf("updateCoins(): PASS when test containing 3 copper 2 silver\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 2 silver \n");

updateCoins(player, G, 7);
    
 if (G->coins == 15)
        printf("updateCoins(): PASS when test containing 3 copper 2 silver 7 bonus\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 2 silver 7 bonus\n");

G->hand[player][G->handCount[player]] = gold;
G->handCount[player]++;

updateCoins(player, G, 0);
    
 if (G->coins == 11)
        printf("updateCoins(): PASS when test containing 3 copper 2 silver 1 gold\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 2 silver 1 gold \n");

updateCoins(player, G, 3);
    
 if (G->coins == 14)
        printf("updateCoins(): PASS when test containing 3 copper 2 silver 1 gold 3 bonus\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 2 silver 1 gold 3 bonus\n");

G->hand[player][G->handCount[player]] = gold;
G->handCount[player]++;

updateCoins(player, G, 0);
    
 if (G->coins == 14)
        printf("updateCoins(): PASS when test containing 3 copper 2 silver 2 gold\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 2 silver 2 gold \n");
    
updateCoins(player, G, 1);
    
 if (G->coins == 15)
        printf("updateCoins(): PASS when test containing 3 copper 2 silver 2 gold 1 bonus\n");
    else
        printf("updateCoins(): FAIL when test containing 3 copper 2 silver 2 gold 1 bonus\n");
    


}


int main(int argc, char *argv[])
{
    testupdateCoins();
    return 0;
}
